<template>
	<uni-popup ref="addPay_pop">
		<view class="addpay">
			<view class="black_1">
				<view class="left" @click="close()">取消</view>
				<view class="middle">付款方式</view>
				<view class="right" @click="submit()">确认</view>
			</view>
			<template v-for="(item,index) in list">
				<view class="item" @click="selecttItem(item,index)">
					<image class="left" :src="'/static/tading/'+item.type+'.png'"></image>
					<view class="text1">{{getName(item.type)}}</view>
					<template v-if="type == 1">
						<uni-icons v-if="item.select" type="checkbox-filled" size="30" color="#FE903D"></uni-icons>
					</template>
					<template v-if="type == 0">
						<uni-icons v-if="current == index" type="checkbox-filled" size="30" color="#FE903D"></uni-icons>
					</template>
				</view>
			</template>
			<view v-if="type == 0" class="item" @click="addType()">
				<image class="left" src="/static/tading/addpayType.png"></image>
				<view class="text1">新增收付款方式</view>
				<uni-icons type="right" size="15" color="#BDB4B4"></uni-icons>
			</view>
		</view>
	
	</uni-popup> 
</template>

<script>
	export default {
		components:{
			
			
		},
		props:{
			success:{
				type:Function,
			},
			add:{
				type:Function,
			}
		},
		name:"payType",
		data() {
			return {
				list:[
					// {
					// 	"id": 0,
					// 	"user_id": 0,
					// 	"type": "wechat",
					// 	"network": null,
					// 	"data": {
					// 		"real_name": "",
					// 		"account_name": "",
					// 		"image": "../../static/my/add_tu.png"
					// 	},
					// }
				],
				current:-1,
				type:0,
			};
		},
		methods:{
			open2(collections){
				this.type = 1
				this.list= collections
				this.$refs.addPay_pop.open('bottom')
			},
			open(){
				this.$refs.addPay_pop.open('bottom')
				this.list.length =0
				this.api.http.requests('exchangecollection/info', {}, res => {
					if (res.data && res.data.length > 0) {
						this.list = this.list.concat(res.data)
					}
				}, "POST")
			},close(){
				this.$refs.addPay_pop.close()
			},
			selecttItem(item,index){
				this.current = index
				this.success(item)
				this.close()
			},
			getName(type){
				var name1 ="USDT"
							
				if(type == 'bank'){
					name1 ="银行卡"
				}
				if(type == 'alipay'){
					name1 ="支付宝"
				}
				if(type == 'wechat'){
					name1 ="微信"
				}
				return name1
			},
			addTypeSucees(item){
				
			},
			tipsTypeSucees(){
				
			},
			addType(){
				this.add()
				this.close()
			},
			submit(){
				this.close()
			}
		}
	}
</script>

<style scoped lang="less">
.addpay{
		background: #FFFFFF;
		border-radius: 28rpx 28rpx 0px 0px;
		padding: 10px 0px 100px 0px;
		
		.black_1{
			display: flex;
			justify-content: space-between;
			text-align: center;
			font-size: 32rpx;
			font-weight: 800;
			color: #2A2A2A;
			padding: 10px;
			.left{
				font-size: 28rpx;
				font-weight: 400;
				color: #969696;
			}
			.right{
				font-size: 28rpx;
				font-weight: 400;
				color: #FE903D;
			}
		}
		.close{
			position: absolute;
			right: 20px;
			top: 20px;
			font-size: 28rpx;
			font-weight: 400;
			color: #969696;
		}
		
		.item{
			// border-bottom: 2rpx solid #ECECEC;
			border-top: 1rpx solid #ECECEC;
			padding: 20px 10px;
			display: flex;
			justify-content: space-between;
			align-items: center;
			.left{
				width: 30px;
				height: 30px;
				
			}
			.text1{
						flex: 1;
						margin-left: 10px;
			}
		}
}
</style>